<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>全部评论</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<include file="public/comm"/>
		<style>
			#pullrefresh li{margin-bottom: 0.5em;}
			#pullrefresh .mui-table-view{background: transparent !important;}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav fs_xl">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">全部评论</h1>
		</header>
		<div id="pullrefresh" class="mui-content mui-scroll-wrapper one_pl fs_xl" style="padding-bottom: initial;">
			<div class="mui-scroll">
				<ul class="mui-table-view mui-table-view-chevron">
					<volist name="comment_list" id="vo">
						<li class="mui-table-view-cell">
							<div class="pl_tit">
								<span class="pl_tx"><img src="{$vo.head_pic}" /></span>
								<span class="pl_name fs_m">{$vo.username}</span>
								<span class="pl_time fs_xs">{$vo.add_time}</span>
							</div>
							<div class="pl_info">
								<p class="fs_xs">{$vo.content}</p>
								<p class="cls">
									<volist name="vo.img" id="voo">
										<span><img src="{$voo}" /></span>
									</volist>
								</p>
							</div>
						</li>
					</volist>
				</ul>
			</div>
		</div>
		<script>
			mui.init({
				pullRefresh: {
					container: '#pullrefresh',
					up: {
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				}
			});
			var page = 0;
			var pagecount ={$pagecount};
			function pullupRefresh() {
				setTimeout(function() {
					mui('#pullrefresh').pullRefresh().endPullupToRefresh((++page >= pagecount)); //参数为true代表没有更多数据了。
					if(page < pagecount){
						getcomment(page);
					}
				}, 1500);
			}
			//上啦加载数据
			function getcomment(page){
				var table = document.body.querySelector('.mui-table-view');
				var cells = document.body.querySelectorAll('.mui-table-view-cell');
				var goods_id = {$goods_id};
				$.ajax({
					type:"POST",
					url:"/Mobile/activity/group_comment",
					data:{"page":page,"id":goods_id},
					dataType:"json",
					async:false,//同步操作
					success:function(date){
						if(date.status == 1){
							$.each(date.data,function(i,comment){
								var li = document.createElement('li');
								li.className = 'mui-table-view-cell';
								var ajaxhtml = '<div class="pl_tit">'+'<span class="pl_tx">'+'<img src="'+comment.head_pic+'" />'+'</span>'+
											   '<span class="pl_name fs_m">'+comment.username+'</span>'+'<span class="pl_time fs_xs">'+comment.add_time+'</span>'+'</div>'+
											   '<div class="pl_info">'+'<p class="fs_xs">'+comment.content+'</p>'+
											   '<p class="cls">';
											   $.each(comment.img,function(i,comment_img){
												   ajaxhtml +=  '<span>'+'<img src="'+comment_img+'" /></span>';
											   });
								ajaxhtml += '</p></div>';
								li.innerHTML = ajaxhtml;
								table.appendChild(li);
							})
						}else{
							$("#goodslist").html("<center>暂无相关商品</center>");
						}
// 						for (var i = cells.length, len = i + 5; i < len; i++) {
// 							var li = document.createElement('li');
// 							li.className = 'mui-table-view-cell';
// 							li.innerHTML = '<li class="mui-table-view-cell">'+'<div class="pl_tit">'+'<span class="pl_tx">'+'<img src="../images/chaye.png" />'+'</span>'+
// 										   '<span class="pl_name fs_m">我是一只小小猫'+'</span>'+'<span class="pl_time fs_xs">2017-02-07 12:24'+'</span>'+'</div>'+
// 										   '<div class="pl_info">'+'<p class="fs_xs">我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿，我要打媳妇儿'+'</p>'+
// 										   '<p class="cls">'+'<span>'+'<img src="../images/img45.png" />'+'</span>'+'<span>'+'<img src="../images/img45.png" />'+'</span>'+
// 										   '<span>'+'<img src="../images/img45.png" />'+'</span>'+'<span>'+'<img src="../images/img45.png" />'+'</span>'+'</p>'+'</div>'+'</li>';
// 							table.appendChild(li);
// 						}
					}
				});
				
				
			}
		</script>
	</body>

</html>